package cn.cat.gitee;

import nl.basjes.parse.useragent.UserAgent;
import nl.basjes.parse.useragent.UserAgentAnalyzer;

import java.util.logging.Logger;

public class UserAgentTest2 {
    Logger logger = Logger.getLogger(UserAgentTest2.class.getName());
    public static void main(String[] args) {
        //缺点：设计比较复杂，上手比较难
        //优点：支持大多数国内浏览器，代码更新较快
        String useragent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SE 2.X MetaSr 1.0; SE 2.X MetaSr 1.0; .NET CLR 2.0.50727; SE 2.X MetaSr 1.0)";
        UserAgentAnalyzer userAgentAnalyzer = UserAgentAnalyzer.newBuilder().withAllFields().build();
        UserAgent.ImmutableUserAgent immutableUserAgent = userAgentAnalyzer.parse(useragent);
        System.out.println(immutableUserAgent.toString());
    }
}
